<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopAddressTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_address', function (Blueprint $table) {
            $table->id();
            $table->string('orderNo', 32)->default('')->comment('订单号');
            $table->unsignedInteger('provinceCode')->default(0)->comment('省code');
            $table->unsignedInteger('cityCode')->default(0)->comment('市code');
            $table->unsignedInteger('areaCode')->default(0)->comment('区code');
            $table->string('addressPrefix', 64)->default('')->comment('省-市-区');
            $table->string('addressDetail', 64)->default('')->comment('详细地址');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '开店地址表';

            $table->index('orderNo', 'idx_orderNo');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_address');
    }
}
